package com.yang.ossservice.controller;

import com.yang.commonutils.R;
import com.yang.ossservice.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


/**
 * @author yds
 * @program edu
 * @description 存储文件请求层
 * @create 2020-11-26 15:04
 **/
@Api(description = "oss存储管理")
@RestController
@RequestMapping("/eduoss/fileoss")
@CrossOrigin
public class OssServiceController {

    @Autowired
    private OssService ossService;

    @ApiOperation("文件上传")
    @PostMapping("upload")
    public R uploadOssFile(MultipartFile file){
        String url=ossService.uploadFileAvatar(file);
        return R.ok().data("url",url);

    }
}
